package edu.xy.hm02_01.slice;

import edu.xy.hm02_01.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class MainAbilitySlice_04 extends AbilitySlice {
    Text text01=null;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        // 设置该页面所关联的页面布局
        super.setUIContent(ResourceTable.Layout_ability_main_04);
        
        //  获取三个组件
        text01=  (Text)this.findComponentById(ResourceTable.Id_text_04_01);
        Button button01 = (Button)this.findComponentById(ResourceTable.Id_button_04_01);
        Button button02 = (Button)this.findComponentById(ResourceTable.Id_button_04_02);
        button01.setClickedListener(this::clickedListenerButton01);
        button02.setClickedListener(this::clickedListenerButton02);


    }

    private void clickedListenerButton02(Component component) {
        text01.setText("单击注册按钮");
    }

    private void clickedListenerButton01(Component component) {
        text01.setText("单击登录按钮");
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
